package highTech.reflect;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Collection;
import java.util.Properties;

public class ClassLoaderTest8 {
	public static void main(String[] args) throws Exception{
		//1.һ��ʹ�������·�������������·��������Ӳ����ķ�ʽ�����Ǽ�������ģ�ex:getRealpath()
//		InputStream ips=new FileInputStream("config.properties");//������ļ�ʱ����ڹ��̵�·��
		//2.ʹ������صķ�ʽ
		InputStream ips=ClassLoaderTest8.class.getClassLoader().getResourceAsStream("reflect/config.properties");
		
//		InputStream ips=ClassLoaderTest8.class.getResourceAsStream("/config.properties");//��ʾҪ�������·��
//		InputStream ips=ClassLoaderTest8.class.getResourceAsStream("config.properties");
		Properties pro=new Properties();
		pro.load(ips);
		ips.close();
		String className=pro.getProperty("className");
		
		Collection collections=(Collection)Class.forName(className).newInstance();
		ReflectPoint rp1=new ReflectPoint(3, 3);
		ReflectPoint rp2=new ReflectPoint(5, 5);
		ReflectPoint rp3=new ReflectPoint(3, 3);
		
		collections.add(rp1);
		collections.add(rp2);
		collections.add(rp3);
		collections.add(rp1);
		
		System.out.println(collections.size());
		
	}

}
